package com.ojoin.trade.supplyloan_core.web.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.utils.TimeUtils;
import com.ojoin.trade.common.web.dao.BaseDao;
import com.ojoin.trade.common.web.service.impl.BaseServiceImpl;
import com.ojoin.trade.supplyloan_core.web.dao.TbSlSupplysettleaccountCheckDao;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlPlatformUser;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlSupplysettleaccountCheck;
import com.ojoin.trade.supplyloan_core.web.service.TbSlSupplysettleaccountCheckService;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 15-10-27
 * Time: 下午3:27
 * To change this template use File | Settings | File Templates.
 */
@Service
public class TbSlSupplysettleaccountCheckServiceImpl extends BaseServiceImpl<TbSlSupplysettleaccountCheck> implements TbSlSupplysettleaccountCheckService {

    @Autowired
    private TbSlSupplysettleaccountCheckDao dao;


    @Override
    protected BaseDao<TbSlSupplysettleaccountCheck> getBaseDao() {
        return dao;
    }

    @Override
    public void insertTbSlSupplysettleaccountCheck(int idOfTbMerchantUser, String platformName, int idOfPlatformUser, String supplySettleAccount, String joinFinancialAccount, int checkStatus, String memo) throws BusinessException {
        TbSlSupplysettleaccountCheck checkvo=new TbSlSupplysettleaccountCheck();
        checkvo.setIdOfPlatformUser(idOfPlatformUser);
        checkvo.setIdOfTbMerchantUser(idOfTbMerchantUser);
        checkvo.setCheckDate(TimeUtils.getCurDate());
        checkvo.setCheckStatus(checkStatus);
        checkvo.setPlatformName(platformName);
        checkvo.setJoinFinancialAccount(joinFinancialAccount);
        checkvo.setMemo(memo);
        checkvo.setSupplySettleAccount(supplySettleAccount);
        (( TbSlSupplysettleaccountCheckDao)this.getBaseDao()).insertTbSlSupplysettleaccountCheck(checkvo);
    }

    @Override
    public TbSlSupplysettleaccountCheck queryAccountCheckByJoinid(int joinid) throws BusinessException {
        return  (( TbSlSupplysettleaccountCheckDao)this.getBaseDao()).queryAccountCheckByJoinidandDate(joinid,TimeUtils.getCurDate());  //To change body of implemented methods use File | Settings | File Templates.
    }
    
	@Override
	public TbSlSupplysettleaccountCheck getAccountCheckVOByPlatformUser(
			TbSlPlatformUser platformUser) {
		TbSlSupplysettleaccountCheck checkvo = new TbSlSupplysettleaccountCheck();
		checkvo.setIdOfPlatformUser(platformUser.getId());
		checkvo.setIdOfTbMerchantUser(platformUser.getIdOfTbMerchantUser());
		checkvo.setPlatformName(platformUser.getPlatformName());
		checkvo.setCheckDate(TimeUtils.getCurDate());
		
		return checkvo;
	}
}
